package com.nbsaas.boot.cms.rest.resource;

import com.nbsaas.boot.cms.api.apis.ArticleCategoryApi;
import com.nbsaas.boot.cms.data.entity.ArticleCategory;
import com.nbsaas.boot.cms.api.domain.request.ArticleCategoryRequest;
import com.nbsaas.boot.cms.api.domain.response.ArticleCategoryResponse;
import com.nbsaas.boot.cms.api.domain.simple.ArticleCategorySimple;
import com.nbsaas.boot.cms.rest.convert.ArticleCategorySimpleConvert;
import com.nbsaas.boot.cms.rest.convert.ArticleCategoryEntityConvert;
import com.nbsaas.boot.cms.rest.convert.ArticleCategoryResponseConvert;
import com.nbsaas.boot.cms.data.repository.ArticleCategoryRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   文章分类-业务接口实现
*/
@Transactional
@Service
public class ArticleCategoryResource extends BaseResource<ArticleCategory,ArticleCategoryResponse, ArticleCategorySimple, ArticleCategoryRequest>  implements ArticleCategoryApi {

    @Resource
    private ArticleCategoryRepository articleCategoryRepository;

    @Override
    public JpaRepositoryImplementation<ArticleCategory, Serializable> getJpaRepository() {
        return articleCategoryRepository;
    }

    @Override
    public Function<ArticleCategory, ArticleCategorySimple> getConvertSimple() {
        return new ArticleCategorySimpleConvert();
    }

    @Override
    public Function<ArticleCategoryRequest, ArticleCategory> getConvertForm() {
        return new ArticleCategoryEntityConvert();
    }

    @Override
    public Function<ArticleCategory, ArticleCategoryResponse> getConvertResponse() {
        return new ArticleCategoryResponseConvert();
    }




}


